<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>用户登录</title>
<script type="text/javascript">
$(document).ready(function() {
	$('#userLoginForm').vaildAjax(function(data) {
		if (data == '') {
			var uri = BaseJs.getUri();
			if(uri.indexOf('Logout.action')!=-1){
				BaseJs.toAction('home/Home');
			}else{
				window.location.reload();
			}
		} else {
			BaseJs.alert(data,'alert');
			if(data=='验证码错误'){
				$('input[name=authNo]').val('');
				$('#maycode').attr('src',BaseJs.root+'authCode.jpg?date='+(new Date()));
			}
		}
	});
	$('#maycode').attr('src',BaseJs.root+'authCode.jpg?date='+(new Date()))
	$('#maycode').click(function(){
		$('#maycode').attr('src',BaseJs.root+'authCode.jpg?date='+(new Date()));
	});
	center();
});
function center(){
	var wei = UtilJs.toInt((document.body.clientWidth - 800)/2);
	var hei = UtilJs.toInt((document.body.clientHeight - 325)/2);
	var _hei = hei<0?0:hei;
	var _left = wei<0?0:wei;
	$('#logonForm').css({ width:'800px',height:'325px',left:_left+'px',top:_hei+'px'});
}
</script>
<style type="text/css">
body{background: url(<s:url value='/common/images/bg_tile.jpg' />) #5A6C84; font-size: 12px;}
#logonForm {background: url(<s:url value='/common/images/logon.png' />) center center no-repeat;position: absolute;}
.textarea,.header{width: 90px;}
th.header{font-size: 12px;}
.textarea2{width: 203px;}
.divlog{width: 350px;position: relative;margin-top: 120px;margin-left: 350px;}
.divlog table th{width: 120px;text-align: right;}
.divlog table input{height: 25px;font-size: 13px;}
.divlogpic{float:left; width: 260px;height:230px; position: relative;margin-top: 50px;margin-left: 50px;}
</style>
</head>
<body>
<s:form id="userLoginForm" action="user/Logon" method="POST">
<div id="logonForm">
	<div class="divlogpic"><img alt="登录界面" src="<s:url value='/common/images/logo_face.png' />"></div>
	<div class="divlog">
		<table style="width:350px;">
			<tr>
				<th class="header">用户名&nbsp;&nbsp;&nbsp;&nbsp;</th>
				<td colspan="2"><s:textfield name="user.nickName"  maxlength="20" cssClass="textarea2" /></td>
			</tr>
			<tr>
				<th class="header">用户密码&nbsp;&nbsp;&nbsp;&nbsp;</th>
				<td colspan="2"><s:password name="user.passwd"  maxlength="32" cssClass="textarea2" /></td>
			</tr>
			<tr>
				<th class="header">验证码&nbsp;&nbsp;&nbsp;&nbsp;</th>
				<td class="100w"><input type="text" name="authNo" class="textarea" maxlength="4" /></td>
				<td><img alt="验证码" id="maycode" title="点击更换验证码" /></td>
			</tr>
			<tr>
				<td colspan="3"><input type="submit" value="登录" style="margin-left:100px;margin-top:20px; width: 128px; height: 32px;"></td>
			</tr>
		</table>
	</div>
	<div style="clear: both;"></div>
</div>
</s:form>
</body>
</html>